package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 学历要求枚举
 * @author helong
 */
@Getter
public enum EducationEnum {

    NO_LIMIT(0, "不限"),
    JUNIOR_COLLEGE(1, "大专"),
    UNDERGRADUATE(2, "本科"),
    MASTER(3, "硕士"),
    PHD(4, "博士");



    private final Integer value;
    private final String text;

    // 构造函数
    EducationEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static EducationEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (EducationEnum educationEnum : EducationEnum.values()) {
            if (educationEnum.getValue().equals(value)) {
                return educationEnum;
            }
        }
        return null;
    }
}
